<?php
	class View implements IConfig_Get
	{
		public static $Smarty=NULL;

        public static function __CallStatic($name,$args)
		{
			if(!self::$Smarty) 
            {
                self::$Smarty=new Smarty();
                foreach(Config::View() as $option=>$value){
                      self::$Smarty->$option=$value;
                }
            }
            return call_user_func_array(array(self::$Smarty,$name),$args);
		}

        public static function GetConfig()
		{
			//检测是否有配置类，如果有配置类并且有针对Smarty的配置。就用配置类的配置覆盖Smarty默认配置。
			if(class_exists('Config'))
			{
				if(method_exists('Config','View'))
				{
					return Config::View();
				}
				else{
					throw new Exception('class.View.SetConfig：Config配置类中不存在View配置方法。');
				}
			}
			else
			{
				throw new Exception('class.View.SetConfig：Config配置类不存在。');
			}
		}
	}
?>